﻿using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;

namespace LdCms.Web.MiddleWares
{
    /// <summary>
    /// 
    /// </summary>
    public class AccessCorsHostMiddleware
    {
        private readonly RequestDelegate Next;
        private readonly IConfiguration Configuration;
        public AccessCorsHostMiddleware(RequestDelegate Next, IConfiguration Configuration)
        {
            this.Next = Next;
            this.Configuration = Configuration;
        }
        public async Task Invoke(HttpContext context)
        {
            try
            {
                var url = Configuration["AppCors:Url"].Split(",");
                await Next(context);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
    }
}
